<template>
  <div class="dashboard-container">
    <div class="app-container">
      <!-- 自定义组件，标题 -->
      <PageTitle :show-before="true">
        <template v-slot:before>
          <h2>广告管理</h2>
        </template>
      </PageTitle>
      <el-row
        :gutter="10"
        type="flex"
        justify="space-between"
        style="margin-top: 10px"
      >
        <el-col :span="10">
          <el-row :gutter="10" type="flex">
            <el-col :span="6">
              <el-select placeholder="不限平台">
                <el-option
                  v-for="item in platform"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="6">
              <el-select placeholder="不限广告位">
                <el-option
                  v-for="item in platform"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="6">
              <el-select placeholder="不限显示状态">
                <el-option
                  v-for="item in showStatus"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="6">
              <el-select placeholder="不限到期时间">
                <el-option
                  v-for="item in becomeTime"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row type="flex">
            <el-col :span="8">
              <el-select placeholder="标题">
                <el-option
                  v-for="item in titleOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-col>
            <el-row type="flex">
              <el-input placeholder="请输入搜索内容"></el-input>
              <el-button type="primary">
                <i class="el-icon-search"></i>
              </el-button>
            </el-row>
          </el-row>
        </el-col>
      </el-row>
      <!-- 数据表 -->
      <el-table
        v-loading="downloadLoading"
        ooltip-effect="dark"
        border
        :data="list"
        max-height="500px"
        style="margin-top: 20px"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" fixed />
        <el-table-column
          label="广告标题"
          align="center"
          width="width"
          prop="id"
          fixed
        />
        <el-table-column
          label="所属平台"
          align="center"
          prop="full_name"
          fixed
        />
        <el-table-column
          label="所属广告位"
          align="center"
          prop="phone"
          width="130"
          fixed
        />
        <el-table-column
          label="开始时间"
          align="center"
          prop="school"
          width="180"
        />
        <el-table-column label="到期时间" align="center" prop="qualification">
        </el-table-column>
        <el-table-column
          label="排序"
          align="center"
          prop="practice_sum"
          width="120"
        />
        <el-table-column
          label="是否显示"
          align="center"
          prop="com_name"
          width="220"
        />
        <el-table-column
          :label="$t('table.actions')"
          width="150"
          align="center"
          fixed="right"
        >
          <template slot-scope="{ row }">
            <el-button
              type="primary"
              icon="el-icon-edit"
              size="mini"
              :disabled="!checkPermission('Intern-show')"
              @click="addRole('edit', row)"
              >查看</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-row :gutter="10" style="margin-top: 20px">
        <el-col :span="8">
          <el-button type="primary" size="small" @click="addManage">添加广告</el-button>
          <el-button type="danger" size="small">删除所选</el-button>
        </el-col>
        <el-col :span="16">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[10, 20, 50, 100]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="255"
            style="text-align: right"
          >
          </el-pagination>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      platform: [
        { id: 1, name: "不限平台" },
        { id: 2, name: "APP" },
        { id: 3, name: "触屏端" },
        { id: 4, name: "微信小程序" },
        { id: 5, name: "pc端" },
      ],
      adPlatform: [{ id: 1, name: "不限广告位" }],
      showStatus: [
        { id: 1, name: "不限显示状态" },
        { id: 2, name: "显示" },
        { id: 3, name: "隐藏" },
      ],
      becomeTime: [
        { id: 1, name: "不限到期时间" },
        { id: 2, name: "已到期" },
        { id: 3, name: "三天内" },
        { id: 4, name: "一周内" },
      ],
      titleOptions: [
        { id: 1, name: "标题" },
        { id: 2, name: "广告ID" },
      ],
    };
  },
  methods: {
    addManage() {
      this.$router.push({
        name:'addManage'
      });
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
